# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-xlsx2csv
pkgname=('python2-xlsx2csv' 'python-xlsx2csv')
_pkgname=xlsx2csv
pkgver=0.8.4
pkgrel=1
pkgdesc='XLSX to CV converter.'
arch=('any')
url='https://pypi.org/project/xlsx2csv/#files'
license=('GPL2')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('4ef235344b5e20f6e6df721e1acb77b40b7b8fc8bf7512c245fe6b52ca58208da118241a6fe64aab674cccab1e17ac659f86786d83b34b3d66d433f01b5765fe')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-xlsx2csv() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  mv "$pkgdir/usr/bin/$_pkgname" "$pkgdir/usr/bin/${_pkgname}2"
}

package_python-xlsx2csv() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

